import request from '@/utils/request'

/**
 * 会员权益
 */
// 获取会员生日权益
export function getBirthdayBenefitConfig() {
  return request({
    url: '/marketing/admin/birthday/config',
    method: 'get'
  })
}

// 获取会员生日权益
export function saveBirthdayBenefitConfig(data) {
  return request({
    url: '/marketing/admin/birthday/save',
    method: 'post',
    data: data
  })
}

// 获取会员日配置列表
export function getMemberDayConfigList() {
  return request({
    url: '/marketing/admin/memberDay/config',
    method: 'get'
  })
}

// 删除会员日
export function delMemberDayConfig(id) {
  return request({
    url: '/marketing/admin/memberDay/' + id,
    method: 'delete'
  })
}

// 保存会员日配置
export function saveMemberDayConfig(data) {
  return request({
    url: '/marketing/admin/memberDay/save',
    method: 'post',
    data: data
  })
}

// 判断会员日配置,折扣是否改变
export function judgeDiscountChange(data) {
  return request({
    url: '/marketing/admin/memberDay/judgeDiscountChange?id=' + data.id,
    method: 'post',
    data: data
  })
}

// 会员生日权益 - 判断折扣是否改变
export function judgeDiscountChangeBirthday(data) {
	return request({
		url: '/marketing/admin/birthday/judgeDiscountChange?id=' + data.id,
		method: 'post',
		data: data
	})
}

// 新增消费赠礼
export function addConsumeAward(data) {
  return request({
    url: '/marketing/admin/activity/consumeAward',
    method: 'post',
    data: data
  })
}

// 更新消费赠礼
export function updateConsumeAward(data) {
  return request({
    url: '/marketing/admin/activity/consumeAward',
    method: 'put',
    data: data
  })
}

// 新增单品活动
export function addSingleItemActivity(data) {
  return request({
    url: '/marketing/admin/activity/singleItemActivity',
    method: 'post',
    data: data
  })
}

// 更新单品活动
export function updateSingleItemActivity(data) {
  return request({
    url: '/marketing/admin/activity/singleItemActivity',
    method: 'put',
    data: data
  })
}

// 消费赠礼详情 根据ID
export function getActivityDetailById(params) {
  return request({
    url: '/marketing/admin/activity/detail',
    method: 'get',
    params: params
  })
}

// 获取列表
export function getActivityList(params) {
  return request({
    url: '/marketing/admin/activity/list',
    method: 'get',
    params: params
  })
}

// 通过ids获取列表
export function getActivityListByIds(data) {
  return request({
    url: '/marketing/admin/activity/activityListById\n',
    method: 'post',
    data: data
  })
}

// 更改活动赠礼状态
export function modifyActivityStatus(data) {
  return request({
    url: '/marketing/admin/activity/statusManage',
    method: 'post',
    data: data
  })
}

// 活动记录
export function getActivityRecords(params) {
  return request({
    url: '/marketing/admin/activity/userActivityRecords',
    method: 'get',
    params: params
  })
}

// 活动统计
export function getActivityStatistics(params) {
  return request({
    url: '/marketing/admin/activity/statistics',
    method: 'get',
    params: params
  })
}

// 活动关联订单
export function singleItemData(params) {
  return request({
    url: '/marketing/admin/activity/singleItemData',
    method: 'get',
    params: params
  })
}

// 活动关联订单
export function getActivitySingleItemOrders(params) {
  return request({
    url: '/marketing/admin/activity/singleItemOrders',
    method: 'get',
    params: params
  })
}

// 活动关联订单
export function singleItemOrdersCount(params) {
  return request({
    url: '/marketing/admin/activity/singleItemOrdersCount',
    method: 'get',
    params: params
  })
}

// 活动库存
export function modifyActivityBudget(data) {
  return request({
    url: '/marketing/admin/activity/changeBudget',
    method: 'post',
    data: data
  })
}

// 添加商品
export function saveMarketingGoods(data) {
  return request({
    url: '/marketing/admin/goods/saveOne',
    method: 'post',
    data: data
  })
}

export function updateMarketingGoods(data) {
  return request({
    url: '/marketing/admin/goods/update',
    method: 'put',
    data: data
  })
}

// 添加商品
export function marketingGoodsList(params) {
  return request({
    url: '/marketing/admin/goods/list',
    method: 'get',
    params: params
  })
}

// 删除商品
export function delMarketingGoods(data) {
  return request({
    url: '/marketing/admin/goods/del',
    method: 'delete',
    data: data
  })
}

// 复制商品
export function copyMarketingGoods(data) {
  return request({
    url: '/marketing/admin/goods/copy',
    method: 'post',
    data: data
  })
}
// 获取弹窗列表
export function getMarketingPopConfigList(params) {
  return request({
    url: '/marketing/admin/popConfig/list',
    method: 'get',
    params
  })
}

// 添加弹窗
export function PopConfigListAdd(data) {
  return request({
    url: '/marketing/admin/popConfig/save',
    method: 'post',
    data: data
  })
}

// 弹窗图列表
export function PopConfigPicList() {
  return request({
    url: '/marketing/admin/popConfig/imgList',
    method: 'get'
  })
}

// 编辑数据回填
export function getPopById(id) {
  return request({
    url: '/marketing/admin/popConfig/getPopById/?id=' + id,
    method: 'get'
  })
}

// 编辑弹窗
export function PopConfigListUpdate(data) {
  return request({
    url: '/marketing/admin/popConfig/update',
    method: 'post',
    data: data
  })
}

// 删除弹窗
export function delPopById(id) {
  return request({
    url: '/marketing/admin/popConfig/delete',
    method: 'DELETE',
    params: { id }
  })
}
